package com.ruowei.modules.foodOrder.domain;

import com.ruowei.modules.foodOrder.domain.enumeration.OrderStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import javax.validation.constraints.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.Instant;

/**
 * 退款申请表
 */
@ApiModel(description = "退款申请表")
@Entity
@Table(name = "refund_application")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class RefundApplication implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 申请编码
     */
    @ApiModelProperty(value = "申请编码")
    @Column(name = "application_code")
    private String applicationCode;

    /**
     * 订单编码
     */
    @ApiModelProperty(value = "订单编码")
    @Column(name = "order_code")
    private String orderCode;

    /**
     * 用户编码
     */
    @ApiModelProperty(value = "用户编码")
    @Column(name = "member_code")
    private String memberCode;

    /**
     * 申请时间
     */
    @ApiModelProperty(value = "申请时间")
    @Column(name = "jhi_time")
    private Instant time;

    /**
     * 申请状态
     */
    @ApiModelProperty(value = "申请状态")
    @Column(name = "status")
    @Enumerated(EnumType.STRING)
    private OrderStatus status;

    /**
     * 退款金额
     */
    @ApiModelProperty(value = "退款金额")
    @Column(name = "return_amount", precision = 21, scale = 2)
    private BigDecimal returnAmount;

    /**
     * 处理时间
     */
    @ApiModelProperty(value = "处理时间")
    @Column(name = "handle_time")
    private Instant handleTime;

    /**
     * 退货原因
     */
    @ApiModelProperty(value = "退货原因")
    @Lob
    @Column(name = "reason")
    private String reason;

    /**
     * 退货描述
     */
    @ApiModelProperty(value = "退货描述")
    @Lob
    @Column(name = "description")
    private String description;

    /**
     * 退货凭证照片
     */
    @Size(max = 2000)
    @ApiModelProperty(value = "退货凭证照片")
    @Column(name = "photos", length = 2000)
    private String photos;

    /**
     * 处理人
     */
    @ApiModelProperty(value = "处理人")
    @Column(name = "handler")
    private String handler;

    /**
     * 处理描述
     */
    @ApiModelProperty(value = "处理描述")
    @Lob
    @Column(name = "handle_remark")
    private String handleRemark;

    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getApplicationCode() {
        return applicationCode;
    }

    public RefundApplication applicationCode(String applicationCode) {
        this.applicationCode = applicationCode;
        return this;
    }

    public void setApplicationCode(String applicationCode) {
        this.applicationCode = applicationCode;
    }

    public String getOrderCode() {
        return orderCode;
    }

    public RefundApplication orderCode(String orderCode) {
        this.orderCode = orderCode;
        return this;
    }

    public void setOrderCode(String orderCode) {
        this.orderCode = orderCode;
    }

    public String getMemberCode() {
        return memberCode;
    }

    public RefundApplication memberCode(String memberCode) {
        this.memberCode = memberCode;
        return this;
    }

    public void setMemberCode(String memberCode) {
        this.memberCode = memberCode;
    }

    public Instant getTime() {
        return time;
    }

    public RefundApplication time(Instant time) {
        this.time = time;
        return this;
    }

    public void setTime(Instant time) {
        this.time = time;
    }

    public OrderStatus getStatus() {
        return status;
    }

    public RefundApplication status(OrderStatus status) {
        this.status = status;
        return this;
    }

    public void setStatus(OrderStatus status) {
        this.status = status;
    }

    public BigDecimal getReturnAmount() {
        return returnAmount;
    }

    public RefundApplication returnAmount(BigDecimal returnAmount) {
        this.returnAmount = returnAmount;
        return this;
    }

    public void setReturnAmount(BigDecimal returnAmount) {
        this.returnAmount = returnAmount;
    }

    public Instant getHandleTime() {
        return handleTime;
    }

    public RefundApplication handleTime(Instant handleTime) {
        this.handleTime = handleTime;
        return this;
    }

    public void setHandleTime(Instant handleTime) {
        this.handleTime = handleTime;
    }

    public String getReason() {
        return reason;
    }

    public RefundApplication reason(String reason) {
        this.reason = reason;
        return this;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public String getDescription() {
        return description;
    }

    public RefundApplication description(String description) {
        this.description = description;
        return this;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getPhotos() {
        return photos;
    }

    public RefundApplication photos(String photos) {
        this.photos = photos;
        return this;
    }

    public void setPhotos(String photos) {
        this.photos = photos;
    }

    public String getHandler() {
        return handler;
    }

    public RefundApplication handler(String handler) {
        this.handler = handler;
        return this;
    }

    public void setHandler(String handler) {
        this.handler = handler;
    }

    public String getHandleRemark() {
        return handleRemark;
    }

    public RefundApplication handleRemark(String handleRemark) {
        this.handleRemark = handleRemark;
        return this;
    }

    public void setHandleRemark(String handleRemark) {
        this.handleRemark = handleRemark;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof RefundApplication)) {
            return false;
        }
        return id != null && id.equals(((RefundApplication) o).id);
    }

    @Override
    public int hashCode() {
        return 31;
    }

    @Override
    public String toString() {
        return "RefundApplication{" +
            "id=" + getId() +
            ", applicationCode='" + getApplicationCode() + "'" +
            ", orderCode='" + getOrderCode() + "'" +
            ", memberCode='" + getMemberCode() + "'" +
            ", time='" + getTime() + "'" +
            ", status='" + getStatus() + "'" +
            ", returnAmount=" + getReturnAmount() +
            ", handleTime='" + getHandleTime() + "'" +
            ", reason='" + getReason() + "'" +
            ", description='" + getDescription() + "'" +
            ", photos='" + getPhotos() + "'" +
            ", handler='" + getHandler() + "'" +
            ", handleRemark='" + getHandleRemark() + "'" +
            "}";
    }
}
